package o2sjsc.core.libs;

import java.security.MessageDigest;

public class Encrypt {

	public static final String toMd5(final String text) {
		try {
			final MessageDigest digest = MessageDigest.getInstance("md5");
			digest.update(text.getBytes());
			final byte[] bytes = digest.digest();
			final StringBuilder sb = new StringBuilder();
			for (int i = 0; i < bytes.length; i++) {
				sb.append(String.format("%02X", bytes[i]));
			}
			return sb.toString();
		} catch (Exception exc) {
			return "";
		}
	}
}
